package com.cts.c2.services;

import java.util.ArrayList;
import java.util.List;

import com.cts.c2.vo.AuthenticateVO;
import com.cts.c2.vo.Community;
import com.cts.c2.vo.UserVO;

public class LoginServiceImpl implements LoginService {
	private static String USER_ID = "175931";
	private static String PWD = "password";

	@Override
	public boolean authenticateUser(AuthenticateVO authenticateVO) {
		if (authenticateVO.getUserId().equals(USER_ID)
				&& authenticateVO.getPassword().equals(PWD))
			return true;

		return false;
	}

	@Override
	public UserVO getUserProfile() {
		Community community;
		List<Community> list = new ArrayList<Community>();
		UserVO userVO = new UserVO();
		userVO.setUserid(USER_ID);
		userVO.setName("Raju Penumatsa");
		userVO.setDesgnation("Associate");
		userVO.setDob("25/10/2011");
		// userVO.set

		community = new Community();
		community.setId("community1");
		community.setName("Java community");
		list.add(community);

		community = new Community();
		community.setId("community2");
		community.setName("Android community");
		list.add(community);

		community = new Community();
		community.setId("community3");
		community.setName("Flex community");
		list.add(community);

		community = new Community();
		community.setId("community4");
		community.setName("Spring community");
		list.add(community);

		userVO.setCommunities((ArrayList<Community>) list);
		return userVO;
	}

}
